package com.chuanyang.driverh.mainstart.adapter;


import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.chuanyang.driverh.R;
import com.chuanyang.driverh.base.BaseListAdapter;
import com.chuanyang.driverh.responseresult.OrderDetailData;

import java.util.List;

public class VarPlaceAdapter extends BaseListAdapter<OrderDetailData.PassPointsBean> {
    private List list;
    private Context context;
    private static VarPlaceHolder holder;
   private int count=0;
    public VarPlaceAdapter(Context context, List<OrderDetailData.PassPointsBean> list) {
      super(context, list);
        this.list=list;
    }


    @Override
    public View getZkView(int position, View convertView, ViewGroup parent) {
     if (convertView==null)
     {
         convertView= View.inflate(getContext(), R.layout.common_item_varpalace,null);
     }
        //获取每个条目要展示的数据
        OrderDetailData.PassPointsBean mitem = getItem(position);
        //获取Viewholder
        holder=  VarPlaceHolder.getHolder(convertView);
        holder.city.setText(mitem.getCity());
        holder.area.setText(mitem.getAddress());
        return convertView;
    }

     static class  VarPlaceHolder
    {
     private TextView city,district,area;


        public VarPlaceHolder(View converView)
        {
            city= (TextView) converView.findViewById(R.id.tv_oredrinfo_city);
//            district= (TextView) converView.findViewById(R.id.tv_varplace_district);
            area= (TextView) converView.findViewById(R.id.tv_oredrinfo_area);
        }
        public  static VarPlaceHolder getHolder(View converView)
        {
            holder = (VarPlaceHolder) converView.getTag();
            if(holder ==null)
            {
                holder =new VarPlaceHolder(converView);
                converView.setTag(holder);
            }
            return holder;
        }
    }
}
